{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/MarkupLM/Fine_tune_MarkupLMForTokenClassification_on_a_custom_dataset.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "dUVFZhSGHm9a"
      },
      "source": [
        "## Set-up environment\n",
        "\n",
        "First, we install 🤗 Transformers.\n",
        "\n",
        "We also install 🤗 Evaluate and Seqeval, for computing metrics like F1, recall and precision."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "j-WxdmxgHbeq",
        "outputId": "9ee605ed-537a-4db3-89ad-772a1e15eca1"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "  Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
            "  Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
            "    Preparing wheel metadata ... \u001b[?25l\u001b[?25hdone\n",
            "\u001b[K     |████████████████████████████████| 163 kB 16.3 MB/s \n",
            "\u001b[K     |████████████████████████████████| 7.0 MB 58.5 MB/s \n",
            "\u001b[?25h  Building wheel for transformers (PEP 517) ... \u001b[?25l\u001b[?25hdone\n"
          ]
        }
      ],
      "source": [
        "!pip install -q git+https://github.com/huggingface/transformers.git"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "!pip install -q evaluate seqeval"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "xxyqIS_WGTEh",
        "outputId": "08e1ce44-e354-4911-c281-60d5353e3e94"
      },
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\u001b[K     |████████████████████████████████| 69 kB 273 kB/s \n",
            "\u001b[K     |████████████████████████████████| 43 kB 1.8 MB/s \n",
            "\u001b[K     |████████████████████████████████| 212 kB 45.1 MB/s \n",
            "\u001b[K     |████████████████████████████████| 115 kB 55.9 MB/s \n",
            "\u001b[K     |████████████████████████████████| 431 kB 62.0 MB/s \n",
            "\u001b[K     |████████████████████████████████| 127 kB 64.5 MB/s \n",
            "\u001b[?25h  Building wheel for seqeval (setup.py) ... \u001b[?25l\u001b[?25hdone\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "MdzHRuE8HoQ3"
      },
      "source": [
        "## Prepare dataset\n",
        "\n",
        "Next, let's load a toy dataset which we'll use to fine-tune MarkupLM on.\n",
        "\n",
        "The goal for the model is to label nodes of HTML strings with the appropriate class."
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "!huggingface-cli login"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ogX6eFH8ovFU",
        "outputId": "4d9dc49d-308b-44e0-ef95-d73f701f5f60"
      },
      "execution_count": 4,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\n",
            "        _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|\n",
            "        _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|\n",
            "        _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|\n",
            "        _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|\n",
            "        _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|\n",
            "\n",
            "        To login, `huggingface_hub` now requires a token generated from https://huggingface.co/settings/tokens .\n",
            "        \n",
            "Token: \n",
            "Login successful\n",
            "Your token has been saved to /root/.huggingface/token\n",
            "\u001b[1m\u001b[31mAuthenticated through git-credential store but this isn't the helper defined on your machine.\n",
            "You might have to re-authenticate when pushing to the Hugging Face Hub. Run the following command in your terminal in case you want to set this credential helper as the default\n",
            "\n",
            "git config --global credential.helper store\u001b[0m\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "from huggingface_hub import HfApi\n",
        "\n",
        "api = HfApi()\n",
        "api.upload_folder(\n",
        "    folder_path='/content/drive/MyDrive/MarkupLM/Notebooks/Tutorial notebooks/snippet_of_codes/atoydataset',\n",
        "    path_in_repo=\"toy_dataset\",\n",
        "    repo_id=\"nielsr/markuplm-toy-dataset\",\n",
        "    repo_type=\"dataset\",\n",
        ")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 35
        },
        "id": "0OOPGtDhoSm7",
        "outputId": "dff61564-6452-4526-b19c-9b4d8e26af01"
      },
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "'https://huggingface.co/datasets/nielsr/markuplm-toy-dataset/tree/main/toy_dataset'"
            ],
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "string"
            }
          },
          "metadata": {},
          "execution_count": 5
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import os\n",
        "import json\n",
        "from huggingface_hub import hf_hub_download\n",
        "\n",
        "file = hf_hub_download(repo_id=\"nielsr/markuplm-toy-dataset\", filename=\"label.json\", repo_type=\"dataset\")\n",
        "\n",
        "with open(file) as f:\n",
        "    labels = json.load(f)\n",
        "\n",
        "for k,v in labels.items():\n",
        "  print(k,v)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8G2U97EDpMLR",
        "outputId": "51e3f5bc-8a39-4441-e72b-ea6af63c9d64"
      },
      "execution_count": 17,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0000 {'model': 'Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE', 'price': '$89.99', 'manufacturer': 'Samsung'}\n",
            "0001 {'model': 'Sony Cyber-shot 10.1 Megapixel Digital Camera - Silver - DSCS930S', 'price': '$55.99', 'manufacturer': 'Sony'}\n",
            "0002 {'model': 'Nikon Coolpix 12.0 MegaPixel Compact Digital Camera - Red - L22', 'price': '$74.99', 'manufacturer': 'Nikon'}\n",
            "0003 {'model': 'Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Red Trim - TL210', 'price': '$94.99', 'manufacturer': 'Samsung'}\n",
            "0004 {'model': 'Nikon Coolpix S60 10.0 MegaPixel Compact Digital Camera - Red - 26134', 'price': '$99.99', 'manufacturer': 'Nikon'}\n",
            "0005 {'model': 'Olympus 14 Megapixel Digital Camera - Grey - OLYM FE-4030 GREY REF', 'price': '$78.99', 'manufacturer': 'Olympus'}\n",
            "0006 {'model': 'Kodak EasyShare 8.2 MegaPixel Digital Camera - Silver - CD14', 'price': '$41.99', 'manufacturer': 'Kodak'}\n",
            "0007 {'model': 'Olympus 10-MegaPixel Digital Camera - Black - FE-25', 'price': '$47.99', 'manufacturer': 'Olympus'}\n",
            "0008 {'model': 'Kodak EasyShare 10.2 Megapixel Compact Digital Camera - Blue - KDK C180 BLUE REF', 'price': '$48.99', 'manufacturer': 'Kodak'}\n",
            "0009 {'model': 'Samsung 12.2 Megapixel Compact Digital Camera - Silver - SL502', 'price': '$59.99', 'manufacturer': 'Olympus'}\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {
        "id": "VR0H546ZIRgF"
      },
      "outputs": [],
      "source": [
        "# import os\n",
        "# import json\n",
        "\n",
        "# basic_dir = '/content/drive/MyDrive/MarkupLM/Notebooks/Tutorial notebooks/snippet_of_codes/atoydataset'\n",
        "# with open(os.path.join(basic_dir, 'label.json')) as f:\n",
        "#     labels = json.load(f)\n",
        "\n",
        "# for k,v in labels.items():\n",
        "#   print(k,v)"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "We'll use MarkupLMFeatureExtractor to extract the nodes and xpaths from the HTML strings. Next, we label the nodes with the appropriate class (in this case, with \"model\", \"price\", \"manufacturer\" or \"other\")."
      ],
      "metadata": {
        "id": "1fseKJnTFHtU"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000,
          "referenced_widgets": [
            "96f3fd4d5d8c41b0b1e90de870504274",
            "65ab01632bcf4b7a8fc1c8226284ca35",
            "5070cf89966f4169847c5f9fbc3bc607",
            "13540c3628654bed8a11669c7070f499",
            "8ad2aabc468c4ac28ca7ec74f5d5c609",
            "9fc13da36c3e4a0eb56ac32cfaa40f88",
            "5ba1470b67624caf890815a747351c6b",
            "4b54ca9031904579a18f8b08bdfc2b27",
            "ce145570f63f4e63b9e36c2dd5e50392",
            "50b92ebd8a87409bbca2981181978509",
            "7b94dad419b641fca3c7eac0d1c5ffc2"
          ]
        },
        "id": "C-0tyZjLHme-",
        "outputId": "9b427849-4752-48a0-d380-a57b987a24b4"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "The cache for model files in Transformers v4.22.0 has been updated. Migrating your old cache. This is a one-time only operation. You can interrupt this and resume the migration later on by calling `transformers.utils.move_cache()`.\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Moving 0 files to the new cache system\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "0it [00:00, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "96f3fd4d5d8c41b0b1e90de870504274"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{'model': 'Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE', 'price': '$89.99', 'manufacturer': 'Samsung'}\n",
            "eCOST.com - Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE\n",
            "Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE\n",
            "12.2 Megapixel, 3x Optical Zoom, 3x Digital Zoom, Dual LCD Displays - Back:  2.7\" Color LCD and Front: 1.5\" Color LCD, Image Stabilization, Image Sensor, SD / SDHC Memory Card Slot - Refurbished / Recertified\n",
            "List Price:\n",
            "$179.00\n",
            "Regular Price:\n",
            "$93.99\n",
            "Price:\n",
            "$89.99\n",
            "You Save:\n",
            "$89.01 (49.73%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "58093748\n",
            "Manufacturer:\n",
            "Samsung\n",
            "MFG Part #:\n",
            "TL205 DARK BLUE\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Sony Cyber-shot 10.1 Megapixel Digital Camera - Silver - DSCS930S', 'price': '$55.99', 'manufacturer': 'Sony'}\n",
            "eCOST.com - Sony Cyber-shot 10.1 Megapixel Digital Camera - Silver - DSCS930S\n",
            "Sony Cyber-shot 10.1 Megapixel Digital Camera - Silver - DSCS930S\n",
            "10.1 Megapixels, 3x Optical Zoom,  6x Precision Digital Zoom, Super HAD CCD, PictBridge,  1/8-1/2000 Shutter Speed, Hand Shake Alert, 2.4\" LCD Display - Refurbished / Recertified\n",
            "List Price:\n",
            "$169.99\n",
            "Regular Price:\n",
            "$76.99\n",
            "Price:\n",
            "$55.99\n",
            "You Save:\n",
            "$114.00 (67.06%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "53284609\n",
            "Manufacturer:\n",
            "Sony\n",
            "MFG Part #:\n",
            "DSCS930S\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Nikon Coolpix 12.0 MegaPixel Compact Digital Camera - Red - L22', 'price': '$74.99', 'manufacturer': 'Nikon'}\n",
            "eCOST.com - Nikon Coolpix 12.0 MegaPixel Compact Digital Camera - Red - L22\n",
            "Nikon Coolpix 12.0 MegaPixel Compact Digital Camera - Red - L22\n",
            "12.0 Megapixels, 3.6x Zoom-NIKKOR Glass Lens, Bright 3\" LCD Display, 3-Way VR Image Stabilization System, TV Model w/ Sound, Red-Eye Fix, 19MB Internal Memory and SD/SDHC Card Slot - Refurbished / Recertified\n",
            "List Price:\n",
            "$179.99\n",
            "Regular Price:\n",
            "$74.99\n",
            "Price:\n",
            "$55.99\n",
            "You Save:\n",
            "$105.00 (58.34%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "59070231\n",
            "Manufacturer:\n",
            "Nikon\n",
            "MFG Part #:\n",
            "L22\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Red Trim - TL210', 'price': '$94.99', 'manufacturer': 'Samsung'}\n",
            "eCOST.com - Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Red Trim - TL210\n",
            "Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Red Trim - TL210\n",
            "I See What You See!  The Samsung TL210 Features Dual LCD Displays - 3\" Rear LCD and 1.5\" Front LCD Display, 12.2 Megapixel, 5x Optical Zoom, 55MB Internal Memory, microSD Memory Card Slot. Refurbished / Recertified\n",
            "List Price:\n",
            "$249.99\n",
            "Regular Price:\n",
            "$104.99\n",
            "Price:\n",
            "$94.99\n",
            "You Save:\n",
            "$155.00 (62.00%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "61745170\n",
            "Manufacturer:\n",
            "Samsung\n",
            "MFG Part #:\n",
            "TL210\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Nikon Coolpix S60 10.0 MegaPixel Compact Digital Camera - Red - 26134', 'price': '$99.99', 'manufacturer': 'Nikon'}\n",
            "eCOST.com - Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Red Trim - TL210\n",
            "Nikon Coolpix S60 10.0 MegaPixel Compact Digital Camera - Red - 26134\n",
            "10.0 MegaPixel, 5x Optical Zoom-NIKKOR Glass Lens, New EXPEED Image Processing, Optical VR Image Stabilization, 3.5\" LCD, 20MB Internal Memory, SD/SDHC Compatible - Nikon Refurbished / Recertified\n",
            "List Price:\n",
            "$299.99\n",
            "Regular Price:\n",
            "$124.99\n",
            "Price:\n",
            "$99.99\n",
            "You Save:\n",
            "$200.00 (66.67%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "51251310\n",
            "Manufacturer:\n",
            "Nikon\n",
            "MFG Part #:\n",
            "26134\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Olympus 14 Megapixel Digital Camera - Grey - OLYM FE-4030 GREY REF', 'price': '$78.99', 'manufacturer': 'Olympus'}\n",
            "eCOST.com - Olympus 14 Megapixel Digital Camera - Grey - OLYM FE-4030 GREY REF\n",
            "Olympus 14 Megapixel Digital Camera - Grey - OLYM FE-4030 GREY REF\n",
            "Enjoy This Sleek High Resolution 14 Megapixel Camera with a 4x Wide Optical Zoom.  Save your Pics with 46MB of Internal Memory and SD / SDHC Memory Card Slot.  2.7\" LCD Display, Advanced Face Detection and More - Recertified / Refurbished\n",
            "List Price:\n",
            "$149.99\n",
            "Regular Price:\n",
            "$95.99\n",
            "Price:\n",
            "$78.99\n",
            "You Save:\n",
            "$71.00 (47.34%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "58942789\n",
            "Manufacturer:\n",
            "Olympus\n",
            "MFG Part #:\n",
            "OLYM FE-4030 GREY REF\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Kodak EasyShare 8.2 MegaPixel Digital Camera - Silver - CD14', 'price': '$41.99', 'manufacturer': 'Kodak'}\n",
            "eCOST.com - Kodak EasyShare 8.2 MegaPixel Digital Camera - Silver - CD14\n",
            "Kodak EasyShare 8.2 MegaPixel Digital Camera - Silver - CD14\n",
            "8.2 MegaPixel, 2.4\" LCD Display, 3x Optical Zoom, 5x Digital Zoom, 16MB Internal Memory and SD/SDHC Memory Card Slot - Refurbished / Recertified\n",
            "List Price:\n",
            "$89.99\n",
            "Price:\n",
            "$41.99\n",
            "You Save:\n",
            "$48.00 (53.34%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "56500750\n",
            "Manufacturer:\n",
            "Kodak\n",
            "MFG Part #:\n",
            "CD14\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Olympus 10-MegaPixel Digital Camera - Black - FE-25', 'price': '$47.99', 'manufacturer': 'Olympus'}\n",
            "eCOST.com - Olympus 10-MegaPixel Digital Camera - Black - FE-25\n",
            "Olympus 10-MegaPixel Digital Camera - Black - FE-25\n",
            "Great for leisure or work.  A 10-MegaPixels with a 3x Optical Zoom & 4x Digital Zoom.   2.4\" LCD Display, Save all your pics in this 19MB Internal Memory and Expansion Card Slot (xD / microSD / microSDHC). Refurbished / Recertified\n",
            "List Price:\n",
            "$109.99\n",
            "Regular Price:\n",
            "$56.99\n",
            "Price:\n",
            "$47.99\n",
            "You Save:\n",
            "$62.00 (56.37%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "55533921\n",
            "Manufacturer:\n",
            "Olympus\n",
            "MFG Part #:\n",
            "FE-25\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Kodak EasyShare 10.2 Megapixel Compact Digital Camera - Blue - KDK C180 BLUE REF', 'price': '$48.99', 'manufacturer': 'Kodak'}\n",
            "eCOST.com - Kodak EasyShare 10.2 Megapixel Compact Digital Camera - Blue - KDK C180 BLUE REF\n",
            "Kodak EasyShare 10.2 Megapixel Compact Digital Camera - Blue - KDK C180 BLUE REF\n",
            "10.2 Megapixel Camera Resolution, 16:9 Aspect Ratio, 3x Optical Zoom, 5x Digital Zoom, 2.4\" Color LCD, 16MB Flash Memory, SD/SDHC Memory Card - Recertified / Refurbished\n",
            "List Price:\n",
            "$124.95\n",
            "Price:\n",
            "$48.99\n",
            "You Save:\n",
            "$75.96 (60.79%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "59070257\n",
            "Manufacturer:\n",
            "Kodak\n",
            "MFG Part #:\n",
            "KDK C180 BLUE REF\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n",
            "{'model': 'Samsung 12.2 Megapixel Compact Digital Camera - Silver - SL502', 'price': '$59.99', 'manufacturer': 'Olympus'}\n",
            "eCOST.com - Samsung 12.2 Megapixel Compact Digital Camera - Silver - SL502\n",
            "Samsung 12.2 Megapixel Compact Digital Camera - Silver - SL502\n",
            "12.2 Megapixel Effective, Digital Image Stabilization, 2.7\" TFT LCD, 31MB Internal Memory, SD/SDHC/MMC Compatible - Samsung Refurbished / Recertified\n",
            "List Price:\n",
            "$199.99\n",
            "Regular Price:\n",
            "$67.99\n",
            "Price:\n",
            "$59.99\n",
            "You Save:\n",
            "$140.00 (70.00%)\n",
            "QTY:\n",
            "Availability:\n",
            "In Stock\n",
            "eCOST Part #:\n",
            "58801062\n",
            "Manufacturer:\n",
            "Samsung\n",
            "MFG Part #:\n",
            "SL502\n",
            "Item Condition:\n",
            "Recertified/Refurbished\n"
          ]
        }
      ],
      "source": [
        "from transformers import MarkupLMFeatureExtractor\n",
        "\n",
        "feature_extractor = MarkupLMFeatureExtractor()\n",
        "\n",
        "# we have 4 labels\n",
        "id2label = {0: \"model\", 1:\"price\", 2:\"manufacturer\", 3:\"other\"}\n",
        "label2id = {label:id for id, label in id2label.items()}\n",
        "\n",
        "data = []\n",
        "for k, v in labels.items():\n",
        "    file_prefix = k\n",
        "    annotations = v\n",
        "    print(annotations)\n",
        "    html_file_path = hf_hub_download(repo_id=\"nielsr/markuplm-toy-dataset\", filename=f\"htmls/{file_prefix}.html\", repo_type=\"dataset\")\n",
        "    with open(html_file_path) as f:\n",
        "        html_code = f.read()\n",
        "    encoding = feature_extractor(html_code)\n",
        "    node_labels = [[]]\n",
        "    for node_text in encoding['nodes'][0]:\n",
        "        print(node_text)\n",
        "        if node_text == annotations['model']:\n",
        "            node_labels[0].append(label2id['model'])\n",
        "        elif node_text == annotations['price']:\n",
        "            node_labels[0].append(label2id['price'])\n",
        "        elif node_text == annotations['manufacturer']:\n",
        "            node_labels[0].append(label2id['manufacturer'])\n",
        "        else:\n",
        "            node_labels[0].append(label2id['other'])\n",
        "    data.append({'nodes': encoding['nodes'],\n",
        "               'xpaths': encoding['xpaths'],\n",
        "               'node_labels': node_labels, })"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 20,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "uMLJ1f_kI72o",
        "outputId": "49d0cac2-497e-4c4f-aa89-1bfba27ece44"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "nodes [['eCOST.com - Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE', 'Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE', '12.2 Megapixel, 3x Optical Zoom, 3x Digital Zoom, Dual LCD Displays - Back:  2.7\" Color LCD and Front: 1.5\" Color LCD, Image Stabilization, Image Sensor, SD / SDHC Memory Card Slot - Refurbished / Recertified', 'List Price:', '$179.00', 'Regular Price:', '$93.99', 'Price:', '$89.99', 'You Save:', '$89.01 (49.73%)', 'QTY:', 'Availability:', 'In Stock', 'eCOST Part #:', '58093748', 'Manufacturer:', 'Samsung', 'MFG Part #:', 'TL205 DARK BLUE', 'Item Condition:', 'Recertified/Refurbished']]\n",
            "xpaths [['/html/head/title', '/html/body/div[1]/div/div/div/div/div/div/div/h1', '/html/body/h2', '/html/body/div[2]/div[5]/div[1]/table/tr[1]/td/table/tr/td[1]', '/html/body/div[2]/div[5]/div[1]/table/tr[1]/td/table/tr/td[2]/table/tr/td/span/span', '/html/body/div[2]/div[5]/div[1]/table/tr[2]/td/table/tr/td[1]', '/html/body/div[2]/div[5]/div[1]/table/tr[2]/td/table/tr/td[2]/table/tr/td/span', '/html/body/div[2]/div[5]/div[1]/table/tr[3]/td/table/tr/td[1]', '/html/body/div[2]/div[5]/div[1]/table/tr[3]/td/table/tr/td[2]/span', '/html/body/div[2]/div[5]/div[1]/table/tr[4]/td/table/tr/td[1]/span', '/html/body/div[2]/div[5]/div[1]/table/tr[4]/td/table/tr/td[2]/span', '/html/body/div[2]/div[5]/div[1]/table/tr[5]/td/div/table/tr/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[1]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[1]/td[2]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[2]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[2]/td[2]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[3]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[3]/td[2]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[4]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[4]/td[2]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[5]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[5]/td[2]']]\n",
            "node_labels [[3, 0, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3]]\n"
          ]
        }
      ],
      "source": [
        "for k,v in data[0].items():\n",
        "  print(k,v)"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "for node, label in zip(data[0]['nodes'][0], data[0]['node_labels'][0]):\n",
        "  print(node, id2label[label])"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "XpckJCd7J8zl",
        "outputId": "9220f72f-a426-421a-f8a7-4180c0838a6e"
      },
      "execution_count": 21,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "eCOST.com - Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE other\n",
            "Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE model\n",
            "12.2 Megapixel, 3x Optical Zoom, 3x Digital Zoom, Dual LCD Displays - Back:  2.7\" Color LCD and Front: 1.5\" Color LCD, Image Stabilization, Image Sensor, SD / SDHC Memory Card Slot - Refurbished / Recertified other\n",
            "List Price: other\n",
            "$179.00 other\n",
            "Regular Price: other\n",
            "$93.99 other\n",
            "Price: other\n",
            "$89.99 price\n",
            "You Save: other\n",
            "$89.01 (49.73%) other\n",
            "QTY: other\n",
            "Availability: other\n",
            "In Stock other\n",
            "eCOST Part #: other\n",
            "58093748 other\n",
            "Manufacturer: other\n",
            "Samsung manufacturer\n",
            "MFG Part #: other\n",
            "TL205 DARK BLUE other\n",
            "Item Condition: other\n",
            "Recertified/Refurbished other\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "T8EJSDe9pFiG"
      },
      "source": [
        "## Create PyTorch Dataset\n",
        "\n",
        "Next, we'll create a regular PyTorch dataset. Each item of the dataset is an HTML string, encoded using MarkupLMProcessor. Note that we initialize the processor with parse_html = False, as we have already parsed the HTML ourselves and we're providing the nodes, xpaths and node labels.\n",
        "\n",
        "Note that by default, the processor will only label the first token of a given node and label the remaining tokens with -100. you can change this by setting the `only_label_first_subword` attribute of the processor's tokenizer to `False`."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "s9dHuyYuIW4B"
      },
      "outputs": [],
      "source": [
        "from torch.utils.data import Dataset\n",
        "\n",
        "class MarkupLMDataset(Dataset):\n",
        "    \"\"\"Dataset for token classification with MarkupLM.\"\"\"\n",
        "\n",
        "    def __init__(self, data, processor=None, max_length=512):\n",
        "        self.data = data\n",
        "        self.processor = processor\n",
        "        self.max_length = max_length\n",
        "\n",
        "    def __len__(self):\n",
        "        return len(self.data)\n",
        "\n",
        "    def __getitem__(self, idx):\n",
        "        # first, get nodes, xpaths and node labels\n",
        "        item = self.data[idx]\n",
        "        nodes, xpaths, node_labels = item['nodes'], item['xpaths'], item['node_labels']\n",
        "\n",
        "        # provide to processor\n",
        "        encoding = self.processor(nodes=nodes, xpaths=xpaths, node_labels=node_labels, padding=\"max_length\",\n",
        "                                  max_length=self.max_length, return_tensors=\"pt\")\n",
        "\n",
        "        # remove batch dimension\n",
        "        encoding = {k: v.squeeze() for k, v in encoding.items()}\n",
        "\n",
        "        return encoding"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "WCUKWCQBJsbO"
      },
      "outputs": [],
      "source": [
        "from transformers import MarkupLMProcessor\n",
        "\n",
        "processor = MarkupLMProcessor.from_pretrained(\"microsoft/markuplm-base\")\n",
        "processor.parse_html = False\n",
        "\n",
        "dataset = MarkupLMDataset(data=data, processor=processor, max_length=512)"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "Let's check an example:"
      ],
      "metadata": {
        "id": "21smnsuRHT1L"
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "DUy59jVdJNiz",
        "outputId": "6a490859-c59b-44b5-aed2-c9a280fee8b6"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "input_ids torch.Size([512])\n",
            "token_type_ids torch.Size([512])\n",
            "attention_mask torch.Size([512])\n",
            "xpath_tags_seq torch.Size([512, 50])\n",
            "xpath_subs_seq torch.Size([512, 50])\n",
            "labels torch.Size([512])\n"
          ]
        }
      ],
      "source": [
        "example = dataset[0]\n",
        "for k,v in example.items():\n",
        "  print(k,v.shape)"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "Let's decode the input_ids back to text:"
      ],
      "metadata": {
        "id": "VIjOQ1JBHVID"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "processor.decode(example['input_ids'])"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 143
        },
        "id": "TMrAPw06KpYk",
        "outputId": "d19a80e4-c815-4582-f03d-25e55c20993a"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "'<s>eCOST.com - Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUESamsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE12.2 Megapixel, 3x Optical Zoom, 3x Digital Zoom, Dual LCD Displays - Back:  2.7\" Color LCD and Front: 1.5\" Color LCD, Image Stabilization, Image Sensor, SD / SDHC Memory Card Slot - Refurbished / RecertifiedList Price:$179.00Regular Price:$93.99Price:$89.99You Save:$89.01 (49.73%)QTY:Availability:In StockeCOST Part #:58093748Manufacturer:SamsungMFG Part #:TL205 DARK BLUEItem Condition:Recertified/Refurbished</s><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad><pad>'"
            ],
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "string"
            }
          },
          "metadata": {},
          "execution_count": 37
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "Let's verify the correspondence between input_ids and labels. -100 means that those tokens will be ignored by the loss function, hence these won't contribute to the final loss. "
      ],
      "metadata": {
        "id": "rlBLWvTWHXXV"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "for id, label in zip(example['input_ids'].tolist(), example['labels'].tolist()):\n",
        "  if label != -100:\n",
        "    print(processor.decode([id]), id2label[label])\n",
        "  else:\n",
        "    print(processor.decode([id]), label)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "jQSPFE02Ks7C",
        "outputId": "dc7dbf76-18dd-4f77-f679-6fffb37c2b4e"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "<s> -100\n",
            "e other\n",
            "CO -100\n",
            "ST -100\n",
            ". -100\n",
            "com -100\n",
            " - -100\n",
            " Samsung -100\n",
            " 12 -100\n",
            ". -100\n",
            "2 -100\n",
            " Mega -100\n",
            "Pixel -100\n",
            " Compact -100\n",
            " Digital -100\n",
            " Camera -100\n",
            " w -100\n",
            "/ -100\n",
            " Dual -100\n",
            " LCD -100\n",
            " Dis -100\n",
            "plays -100\n",
            " - -100\n",
            " Dark -100\n",
            " Blue -100\n",
            " - -100\n",
            " TL -100\n",
            "205 -100\n",
            " DARK -100\n",
            " BL -100\n",
            "UE -100\n",
            "Samsung model\n",
            " 12 -100\n",
            ". -100\n",
            "2 -100\n",
            " Mega -100\n",
            "Pixel -100\n",
            " Compact -100\n",
            " Digital -100\n",
            " Camera -100\n",
            " w -100\n",
            "/ -100\n",
            " Dual -100\n",
            " LCD -100\n",
            " Dis -100\n",
            "plays -100\n",
            " - -100\n",
            " Dark -100\n",
            " Blue -100\n",
            " - -100\n",
            " TL -100\n",
            "205 -100\n",
            " DARK -100\n",
            " BL -100\n",
            "UE -100\n",
            "12 other\n",
            ". -100\n",
            "2 -100\n",
            " Meg -100\n",
            "apixel -100\n",
            ", -100\n",
            " 3 -100\n",
            "x -100\n",
            " Optical -100\n",
            " Zoom -100\n",
            ", -100\n",
            " 3 -100\n",
            "x -100\n",
            " Digital -100\n",
            " Zoom -100\n",
            ", -100\n",
            " Dual -100\n",
            " LCD -100\n",
            " Dis -100\n",
            "plays -100\n",
            " - -100\n",
            " Back -100\n",
            ": -100\n",
            "  -100\n",
            " 2 -100\n",
            ". -100\n",
            "7 -100\n",
            "\" -100\n",
            " Color -100\n",
            " LCD -100\n",
            " and -100\n",
            " Front -100\n",
            ": -100\n",
            " 1 -100\n",
            ". -100\n",
            "5 -100\n",
            "\" -100\n",
            " Color -100\n",
            " LCD -100\n",
            ", -100\n",
            " Image -100\n",
            " St -100\n",
            "abil -100\n",
            "ization -100\n",
            ", -100\n",
            " Image -100\n",
            " Sensor -100\n",
            ", -100\n",
            " SD -100\n",
            " / -100\n",
            " SD -100\n",
            "HC -100\n",
            " Memory -100\n",
            " Card -100\n",
            " Slot -100\n",
            " - -100\n",
            " Ref -100\n",
            "urb -100\n",
            "ished -100\n",
            " / -100\n",
            " Rec -100\n",
            "ert -100\n",
            "ified -100\n",
            "List other\n",
            " Price -100\n",
            ": -100\n",
            "$ other\n",
            "179 -100\n",
            ". -100\n",
            "00 -100\n",
            "Regular other\n",
            " Price -100\n",
            ": -100\n",
            "$ other\n",
            "93 -100\n",
            ". -100\n",
            "99 -100\n",
            "Price other\n",
            ": -100\n",
            "$ price\n",
            "89 -100\n",
            ". -100\n",
            "99 -100\n",
            "You other\n",
            " Save -100\n",
            ": -100\n",
            "$ other\n",
            "89 -100\n",
            ". -100\n",
            "01 -100\n",
            " ( -100\n",
            "49 -100\n",
            ". -100\n",
            "73 -100\n",
            "%) -100\n",
            "Q other\n",
            "TY -100\n",
            ": -100\n",
            "Availability other\n",
            ": -100\n",
            "In other\n",
            " Stock -100\n",
            "e other\n",
            "CO -100\n",
            "ST -100\n",
            " Part -100\n",
            " # -100\n",
            ": -100\n",
            "5 other\n",
            "809 -100\n",
            "37 -100\n",
            "48 -100\n",
            "Manufact other\n",
            "urer -100\n",
            ": -100\n",
            "Samsung manufacturer\n",
            "M other\n",
            "FG -100\n",
            " Part -100\n",
            " # -100\n",
            ": -100\n",
            "TL other\n",
            "205 -100\n",
            " DARK -100\n",
            " BL -100\n",
            "UE -100\n",
            "Item other\n",
            " Condition -100\n",
            ": -100\n",
            "Rec other\n",
            "ert -100\n",
            "ified -100\n",
            "/ -100\n",
            "Ref -100\n",
            "urb -100\n",
            "ished -100\n",
            "</s> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n",
            "<pad> -100\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "r3M3GO0epfN6"
      },
      "source": [
        "## Create PyTorch Dataloaders\n",
        "\n",
        "The next step is to create a PyTorch DataLoader, which allows us to get batches from the dataset."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "Nw8AYMRtJPXh"
      },
      "outputs": [],
      "source": [
        "from torch.utils.data import DataLoader\n",
        "\n",
        "dataloader = DataLoader(dataset, batch_size=2, shuffle=True)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-9RF4YuYtPfZ"
      },
      "source": [
        "## Define model\n",
        "\n",
        "We define the model here, which is a MarkupLM-base Transformer, with a token classifier head on top. The token classifier will have randomly initialized weights, while the base Transformer has pre-trained weights.\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "JyAcG4VttQPF",
        "outputId": "27d68619-6d2c-4296-d3d9-7b5df27fb105"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "Some weights of the model checkpoint at microsoft/markuplm-base were not used when initializing MarkupLMForTokenClassification: ['nrp_cls.decoder.weight', 'cls.predictions.transform.dense.bias', 'markuplm.pooler.dense.bias', 'markuplm.pooler.dense.weight', 'cls.predictions.decoder.bias', 'cls.predictions.decoder.weight', 'nrp_cls.LayerNorm.bias', 'ptc_cls.weight', 'cls.predictions.transform.dense.weight', 'ptc_cls.bias', 'nrp_cls.dense.bias', 'cls.predictions.transform.LayerNorm.weight', 'nrp_cls.dense.weight', 'nrp_cls.LayerNorm.weight', 'nrp_cls.decoder.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.bias']\n",
            "- This IS expected if you are initializing MarkupLMForTokenClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
            "- This IS NOT expected if you are initializing MarkupLMForTokenClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
            "Some weights of MarkupLMForTokenClassification were not initialized from the model checkpoint at microsoft/markuplm-base and are newly initialized: ['classifier.weight', 'classifier.bias']\n",
            "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
          ]
        }
      ],
      "source": [
        "from transformers import MarkupLMForTokenClassification\n",
        "\n",
        "model = MarkupLMForTokenClassification.from_pretrained(\"microsoft/markuplm-base\", id2label=id2label, label2id=label2id)"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "We also create a label_list, where each tag starts with a B (as seqeval expects the labels to be in IOB format)."
      ],
      "metadata": {
        "id": "_PNbHdFRJtsA"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "label_list = [\"B-\" + x for x in list(id2label.values())]\n",
        "label_list"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "wJsuIvJiJURr",
        "outputId": "b546f913-44df-4e2b-d47a-362a665807b1"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "['B-model', 'B-price', 'B-manufacturer', 'B-other']"
            ]
          },
          "metadata": {},
          "execution_count": 22
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "We also define metric calculations (as we'd like to know the F1 score etc. during training). We'll use 🤗 [Evaluate](https://huggingface.co/docs/evaluate/index) for that, which is a library containing many tools for evaluating ML models."
      ],
      "metadata": {
        "id": "ltFVhjQxH3ju"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "import evaluate\n",
        "\n",
        "# Metric\n",
        "metric = evaluate.load(\"seqeval\")\n",
        "\n",
        "def get_labels(predictions, references):\n",
        "    # Transform predictions and references tensos to numpy arrays\n",
        "    if device.type == \"cpu\":\n",
        "        y_pred = predictions.detach().clone().numpy()\n",
        "        y_true = references.detach().clone().numpy()\n",
        "    else:\n",
        "        y_pred = predictions.detach().cpu().clone().numpy()\n",
        "        y_true = references.detach().cpu().clone().numpy()\n",
        "\n",
        "    # Remove ignored index (special tokens)\n",
        "    true_predictions = [\n",
        "        [label_list[p] for (p, l) in zip(pred, gold_label) if l != -100]\n",
        "        for pred, gold_label in zip(y_pred, y_true)\n",
        "    ]\n",
        "    true_labels = [\n",
        "        [label_list[l] for (p, l) in zip(pred, gold_label) if l != -100]\n",
        "        for pred, gold_label in zip(y_pred, y_true)\n",
        "    ]\n",
        "    return true_predictions, true_labels\n",
        "\n",
        "def compute_metrics(return_entity_level_metrics=True):\n",
        "    results = metric.compute()\n",
        "    if return_entity_level_metrics:\n",
        "        # Unpack nested dictionaries\n",
        "        final_results = {}\n",
        "        for key, value in results.items():\n",
        "            if isinstance(value, dict):\n",
        "                for n, v in value.items():\n",
        "                    final_results[f\"{key}_{n}\"] = v\n",
        "            else:\n",
        "                final_results[key] = value\n",
        "        return final_results\n",
        "    else:\n",
        "        return {\n",
        "            \"precision\": results[\"overall_precision\"],\n",
        "            \"recall\": results[\"overall_recall\"],\n",
        "            \"f1\": results[\"overall_f1\"],\n",
        "            \"accuracy\": results[\"overall_accuracy\"],\n",
        "        }"
      ],
      "metadata": {
        "id": "AY2-kD30Fqrh"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Train\n",
        "\n",
        "Alright, let's train! Here we're training the model in native PyTorch, but of course you could also opt for things like 🤗 Accelerate, 🤗 Trainer, PyTorch Lightning,..."
      ],
      "metadata": {
        "id": "r2RfrAhyKIcJ"
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 733,
          "referenced_widgets": [
            "1efaab196cdf413290a431658a7c37e8",
            "e950ba6862394e4483a706a568dcf3cb",
            "d8e5f48f3f7840e0b838df80f9d07527",
            "5449b664cffc4fbb8418fddcd42259b5",
            "2a11a94624d34901806ceafd5108ca41",
            "9209dbaeba4941a5841cc1ca3a4ae845",
            "4b58dbaea1e64cc0887d32810f0b2994",
            "111db982b6c34747bd360624ea4cbe5e",
            "295b69341c314474acc9de4eaab35361",
            "18aa73713f2d4662b644a5da65ed0abc",
            "709a75a2ea9544f3af191e5da3f455b1",
            "41b1ff7ceb27460f8d728e6adbaabb73",
            "77abcf0972874873bcd42396f9df50e8",
            "c804100a751046b880c6f3d351fa8bc7",
            "c2241e09ad504051a7eb87496c53f1a5",
            "17e96e75dd304daf900d88d4f7048c6a",
            "309e78727d274c75bdfbe6f3e0bc382c",
            "b5ff4bccd4624e84bb0fd0a5f9039564",
            "fee7a9b53c43490ea51965ec41493e32",
            "2b0d37003ffd4f548bb493ff2f96fd40",
            "efe083fa06ba4ef985fb8994f1b06c14",
            "560a2a34c5d84469b61da36f5884a102",
            "1b31f8ee960a4559b7e928d98acd088b",
            "daeabfc06460439ebde9fb9436ff244a",
            "90385338c5694374b42d47c84a76fcd9",
            "fd2e438e8b4a47928e8d42476dca5c6a",
            "99d03b6b90ae412891ed40a7f7a8fc17",
            "d78d5b3f146f4604a78c08caae41b4d3",
            "fa4d09ebbd604480bb7cfeaf6bcb4a2b",
            "2884c008a0064b488b0e5e8882ab4db8",
            "ff10c7e80e604bf9934af3d6c87b3d69",
            "b5c7931dc5fb471f99612f60c6b1b6e6",
            "75aa20be4912412b9326ad4fd175e94c",
            "fb87df90c6754443b848d2906b70c20c",
            "897d441504394c13be74d6527d43e2ad",
            "c5cf507b895043df88478cb0b36c88c8",
            "34cf46270d844b4e9d9de27d9437a0bf",
            "95fc5b04e9174cda9e6ba8859355eac2",
            "0c145c54461e4f748e630608e572d656",
            "a3d2d3776c50425e82e880aaf53266c5",
            "810c4546e9a54279a0169a8f219921d1",
            "4a5f6116b4504b79845fe0f024f76045",
            "a7e6451644684b0ba08b1fef97d8bffe",
            "0bd6f854922b42209c34644d064fc784",
            "9a960e309c4547739b85684fd22a7434",
            "1b04d7d7c64e46c7a65fec70a8aa6d47",
            "62ca6a355eba4d8b9246196543651611",
            "1dfb949779dd4c63a6008aa28c7ce877",
            "a3d7e773a941411d843e1d97501bbbc1",
            "4161733518e9413dbfd46df36b44cdfc",
            "fd55d9ea99994dbe9fcbde47912f6d3c",
            "c2bd8b713ab34602882409fce6ea137c",
            "bad50a6972ba4cc89ace07948e418348",
            "2403434c28334c5b9fdc25e39177673d",
            "a7268c5d50a8461eb505c826d7e7fa8f"
          ]
        },
        "id": "JMqpXGx6sJ7u",
        "outputId": "1d8b34aa-531b-4590-b718-7fde4ff85f97"
      },
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "  0%|          | 0/5 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "1efaab196cdf413290a431658a7c37e8"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Loss: 0.0028853437397629023\n",
            "Loss: 0.16177695989608765\n",
            "Loss: 0.004325489979237318\n",
            "Loss: 0.0730261281132698\n",
            "Loss: 0.010141934268176556\n",
            "Epoch 0: {'manufacturer_precision': 1.0, 'manufacturer_recall': 1.0, 'manufacturer_f1': 1.0, 'manufacturer_number': 9, 'model_precision': 1.0, 'model_recall': 1.0, 'model_f1': 1.0, 'model_number': 10, 'other_precision': 0.9893048128342246, 'other_recall': 0.9893048128342246, 'other_f1': 0.9893048128342246, 'other_number': 187, 'price_precision': 0.8, 'price_recall': 0.8, 'price_f1': 0.8000000000000002, 'price_number': 10, 'overall_precision': 0.9814814814814815, 'overall_recall': 0.9814814814814815, 'overall_f1': 0.9814814814814815, 'overall_accuracy': 0.9814814814814815}\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "  0%|          | 0/5 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "41b1ff7ceb27460f8d728e6adbaabb73"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Loss: 0.0028456775471568108\n",
            "Loss: 0.06846997886896133\n",
            "Loss: 0.007746108807623386\n",
            "Loss: 0.009106344543397427\n",
            "Loss: 0.007496472913771868\n",
            "Epoch 1: {'manufacturer_precision': 1.0, 'manufacturer_recall': 1.0, 'manufacturer_f1': 1.0, 'manufacturer_number': 9, 'model_precision': 1.0, 'model_recall': 1.0, 'model_f1': 1.0, 'model_number': 10, 'other_precision': 1.0, 'other_recall': 0.9946524064171123, 'other_f1': 0.9973190348525469, 'other_number': 187, 'price_precision': 0.9090909090909091, 'price_recall': 1.0, 'price_f1': 0.9523809523809523, 'price_number': 10, 'overall_precision': 0.9953703703703703, 'overall_recall': 0.9953703703703703, 'overall_f1': 0.9953703703703703, 'overall_accuracy': 0.9953703703703703}\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "  0%|          | 0/5 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "1b31f8ee960a4559b7e928d98acd088b"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Loss: 0.004064284730702639\n",
            "Loss: 0.004021643660962582\n",
            "Loss: 0.03697982430458069\n",
            "Loss: 0.004647796507924795\n",
            "Loss: 0.010091465897858143\n",
            "Epoch 2: {'manufacturer_precision': 1.0, 'manufacturer_recall': 1.0, 'manufacturer_f1': 1.0, 'manufacturer_number': 9, 'model_precision': 1.0, 'model_recall': 1.0, 'model_f1': 1.0, 'model_number': 10, 'other_precision': 1.0, 'other_recall': 0.9946524064171123, 'other_f1': 0.9973190348525469, 'other_number': 187, 'price_precision': 0.9090909090909091, 'price_recall': 1.0, 'price_f1': 0.9523809523809523, 'price_number': 10, 'overall_precision': 0.9953703703703703, 'overall_recall': 0.9953703703703703, 'overall_f1': 0.9953703703703703, 'overall_accuracy': 0.9953703703703703}\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "  0%|          | 0/5 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "fb87df90c6754443b848d2906b70c20c"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Loss: 0.023364050313830376\n",
            "Loss: 0.003646040568128228\n",
            "Loss: 0.009868927299976349\n",
            "Loss: 0.007390023209154606\n",
            "Loss: 0.010390682145953178\n",
            "Epoch 3: {'manufacturer_precision': 1.0, 'manufacturer_recall': 1.0, 'manufacturer_f1': 1.0, 'manufacturer_number': 9, 'model_precision': 1.0, 'model_recall': 1.0, 'model_f1': 1.0, 'model_number': 10, 'other_precision': 1.0, 'other_recall': 1.0, 'other_f1': 1.0, 'other_number': 187, 'price_precision': 1.0, 'price_recall': 1.0, 'price_f1': 1.0, 'price_number': 10, 'overall_precision': 1.0, 'overall_recall': 1.0, 'overall_f1': 1.0, 'overall_accuracy': 1.0}\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "  0%|          | 0/5 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "9a960e309c4547739b85684fd22a7434"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Loss: 0.008640694431960583\n",
            "Loss: 0.0014533746289089322\n",
            "Loss: 0.0015390758635476232\n",
            "Loss: 0.0013109208084642887\n",
            "Loss: 0.0010877938475459814\n",
            "Epoch 4: {'manufacturer_precision': 1.0, 'manufacturer_recall': 1.0, 'manufacturer_f1': 1.0, 'manufacturer_number': 9, 'model_precision': 1.0, 'model_recall': 1.0, 'model_f1': 1.0, 'model_number': 10, 'other_precision': 1.0, 'other_recall': 1.0, 'other_f1': 1.0, 'other_number': 187, 'price_precision': 1.0, 'price_recall': 1.0, 'price_f1': 1.0, 'price_number': 10, 'overall_precision': 1.0, 'overall_recall': 1.0, 'overall_f1': 1.0, 'overall_accuracy': 1.0}\n"
          ]
        }
      ],
      "source": [
        "import torch\n",
        "from torch.optim import AdamW\n",
        "from tqdm.auto import tqdm\n",
        "\n",
        "optimizer = AdamW(model.parameters(), lr=5e-5)\n",
        "\n",
        "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
        "\n",
        "model.to(device)\n",
        "\n",
        "model.train()\n",
        "for epoch in range(5):  # loop over the dataset multiple times\n",
        "    for batch in tqdm(dataloader):\n",
        "        # get the inputs;\n",
        "        inputs = {k:v.to(device) for k,v in batch.items()}\n",
        "\n",
        "        # zero the parameter gradients\n",
        "        optimizer.zero_grad()\n",
        "\n",
        "        # forward + backward + optimize\n",
        "        outputs = model(**inputs)\n",
        "\n",
        "        loss = outputs.loss\n",
        "        loss.backward()\n",
        "        optimizer.step()\n",
        "\n",
        "        print(\"Loss:\", loss.item())\n",
        "\n",
        "        predictions = outputs.logits.argmax(dim=-1)\n",
        "        labels = batch[\"labels\"]\n",
        "        preds, refs = get_labels(predictions, labels)\n",
        "        metric.add_batch(\n",
        "            predictions=preds,\n",
        "            references=refs,\n",
        "        )\n",
        "\n",
        "    eval_metric = compute_metrics()\n",
        "    print(f\"Epoch {epoch}:\", eval_metric)"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Inference\n",
        "\n",
        "Let's try out the model on a new web page for which we have the nodes and xpaths. Here we'll just use one of our training set."
      ],
      "metadata": {
        "id": "JE12rK9mLCor"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "nodes = data[0]['nodes']\n",
        "xpaths = data[0]['xpaths']\n",
        "node_labels = data[0]['node_labels']\n",
        "print(\"Nodes:\", nodes)\n",
        "print(\"Xpaths:\", xpaths)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ymI2oy8ULQR_",
        "outputId": "064c4ced-508b-4872-ee88-f7c78bcc3a3b"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Nodes: [['eCOST.com - Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE', 'Samsung 12.2 MegaPixel Compact Digital Camera w/ Dual LCD Displays - Dark Blue - TL205 DARK BLUE', '12.2 Megapixel, 3x Optical Zoom, 3x Digital Zoom, Dual LCD Displays - Back:  2.7\" Color LCD and Front: 1.5\" Color LCD, Image Stabilization, Image Sensor, SD / SDHC Memory Card Slot - Refurbished / Recertified', 'List Price:', '$179.00', 'Regular Price:', '$93.99', 'Price:', '$89.99', 'You Save:', '$89.01 (49.73%)', 'QTY:', 'Availability:', 'In Stock', 'eCOST Part #:', '58093748', 'Manufacturer:', 'Samsung', 'MFG Part #:', 'TL205 DARK BLUE', 'Item Condition:', 'Recertified/Refurbished']]\n",
            "Xpaths: [['/html/head/title', '/html/body/div[1]/div/div/div/div/div/div/div/h1', '/html/body/h2', '/html/body/div[2]/div[5]/div[1]/table/tr[1]/td/table/tr/td[1]', '/html/body/div[2]/div[5]/div[1]/table/tr[1]/td/table/tr/td[2]/table/tr/td/span/span', '/html/body/div[2]/div[5]/div[1]/table/tr[2]/td/table/tr/td[1]', '/html/body/div[2]/div[5]/div[1]/table/tr[2]/td/table/tr/td[2]/table/tr/td/span', '/html/body/div[2]/div[5]/div[1]/table/tr[3]/td/table/tr/td[1]', '/html/body/div[2]/div[5]/div[1]/table/tr[3]/td/table/tr/td[2]/span', '/html/body/div[2]/div[5]/div[1]/table/tr[4]/td/table/tr/td[1]/span', '/html/body/div[2]/div[5]/div[1]/table/tr[4]/td/table/tr/td[2]/span', '/html/body/div[2]/div[5]/div[1]/table/tr[5]/td/div/table/tr/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[1]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[1]/td[2]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[2]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[2]/td[2]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[3]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[3]/td[2]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[4]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[4]/td[2]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[5]/td[1]', '/html/body/div[2]/div[5]/div[2]/div/table/tr[5]/td[2]']]\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "We'll prepare the example for the model using the processor. Note that we're passing `return_offsets_mapping=True`, as the offsets allow us to determine which tokens are at the start of a given word at which aren't."
      ],
      "metadata": {
        "id": "2jQtg6oQKWZR"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# prepare for model\n",
        "# note that you don't need to prepare node_labels, we just have them available here so we'll compare to the ground truth\n",
        "encoding = processor(nodes=nodes, xpaths=xpaths, node_labels=node_labels, return_offsets_mapping=True, return_tensors=\"pt\").to(device)\n",
        "for k,v in encoding.items():\n",
        "  print(k,v.shape)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "n50NqF54Lbae",
        "outputId": "cde4d236-c885-4844-ede8-13d2f0f7f698"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "input_ids torch.Size([1, 192])\n",
            "token_type_ids torch.Size([1, 192])\n",
            "attention_mask torch.Size([1, 192])\n",
            "offset_mapping torch.Size([1, 192, 2])\n",
            "xpath_tags_seq torch.Size([1, 192, 50])\n",
            "xpath_subs_seq torch.Size([1, 192, 50])\n",
            "labels torch.Size([1, 192])\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "Let's perform a forward pass:"
      ],
      "metadata": {
        "id": "I-W-GXeELgJ1"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# we don't need the offset mapping and labels for the forward pass\n",
        "offset_mapping = encoding.pop(\"offset_mapping\")\n",
        "labels = encoding.pop(\"labels\")\n",
        "\n",
        "# forward pass\n",
        "with torch.no_grad():\n",
        "  outputs = model(**encoding)"
      ],
      "metadata": {
        "id": "x-h3hDVxLijL"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "The model outputs logits of shape (batch_size, seq_len, num_labels). We just take the highest logit (score) per token as prediction:"
      ],
      "metadata": {
        "id": "Udp-oVfDLlvA"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "predictions = outputs.logits.argmax(-1)\n",
        "print(predictions)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "dWdwzINYLoFd",
        "outputId": "67ce9009-0c57-43a6-c6fa-08aa06569f35"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "tensor([[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,\n",
            "         3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 3,\n",
            "         3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\n",
            "         3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\n",
            "         3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\n",
            "         3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 1, 3, 3, 3, 3, 3, 3, 3,\n",
            "         3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\n",
            "         3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]],\n",
            "       device='cuda:0')\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "The model makes predictions at the token level, however we're only interested in the predicted label for the first token of each node.\n",
        "\n",
        "This can be achieved by accessing the word_ids (to know whether or not the token is a special token or not) and the offset_mapping (to know whether or not the token is the first of a particular node)."
      ],
      "metadata": {
        "id": "TkI-FtHlQ2Hb"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "results = {\"Node\": [], \"Predicted\": [], \"Ground truth\": []}\n",
        "\n",
        "for pred_id, word_id, offset, label_id in zip(predictions[0].tolist(), encoding.word_ids(0), offset_mapping[0].tolist(), labels[0].tolist()):\n",
        "  if word_id is not None and offset[0] == 0:\n",
        "    # print(f\"Node: {nodes[0][word_id]}\")\n",
        "    # print(f\"Predicted: {id2label[pred_id]}\")\n",
        "    # print(f\"Ground truth: {id2label[label_id]}\")\n",
        "    # print(\"----------\")\n",
        "    results[\"Node\"].append(nodes[0][word_id])\n",
        "    results[\"Predicted\"].append(id2label[pred_id])\n",
        "    results[\"Ground truth\"].append(id2label[label_id])"
      ],
      "metadata": {
        "id": "byCinM3WOYSL"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Let's pretty print the results as a Pandas dataframe:"
      ],
      "metadata": {
        "id": "nqUsGFfZLxVl"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "import pandas as pd\n",
        "\n",
        "pd.DataFrame.from_dict(results).head()"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 206
        },
        "id": "dBCkbX-_QUUa",
        "outputId": "5090c1a0-c0ca-4aaf-de1b-821ff6249d1e"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                Node Predicted Ground truth\n",
              "0  eCOST.com - Samsung 12.2 MegaPixel Compact Dig...     other        other\n",
              "1  Samsung 12.2 MegaPixel Compact Digital Camera ...     model        model\n",
              "2  12.2 Megapixel, 3x Optical Zoom, 3x Digital Zo...     other        other\n",
              "3                                        List Price:     other        other\n",
              "4                                            $179.00     other        other"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-bb5cd3b2-027e-44df-91e4-7ad12c7075ad\">\n",
              "    <div class=\"colab-df-container\">\n",
              "      <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Node</th>\n",
              "      <th>Predicted</th>\n",
              "      <th>Ground truth</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>eCOST.com - Samsung 12.2 MegaPixel Compact Dig...</td>\n",
              "      <td>other</td>\n",
              "      <td>other</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>Samsung 12.2 MegaPixel Compact Digital Camera ...</td>\n",
              "      <td>model</td>\n",
              "      <td>model</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>12.2 Megapixel, 3x Optical Zoom, 3x Digital Zo...</td>\n",
              "      <td>other</td>\n",
              "      <td>other</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>List Price:</td>\n",
              "      <td>other</td>\n",
              "      <td>other</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>$179.00</td>\n",
              "      <td>other</td>\n",
              "      <td>other</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-bb5cd3b2-027e-44df-91e4-7ad12c7075ad')\"\n",
              "              title=\"Convert this dataframe to an interactive table.\"\n",
              "              style=\"display:none;\">\n",
              "        \n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "       width=\"24px\">\n",
              "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
              "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
              "  </svg>\n",
              "      </button>\n",
              "      \n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      flex-wrap:wrap;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "      <script>\n",
              "        const buttonEl =\n",
              "          document.querySelector('#df-bb5cd3b2-027e-44df-91e4-7ad12c7075ad button.colab-df-convert');\n",
              "        buttonEl.style.display =\n",
              "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "        async function convertToInteractive(key) {\n",
              "          const element = document.querySelector('#df-bb5cd3b2-027e-44df-91e4-7ad12c7075ad');\n",
              "          const dataTable =\n",
              "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                     [key], {});\n",
              "          if (!dataTable) return;\n",
              "\n",
              "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "            + ' to learn more about interactive tables.';\n",
              "          element.innerHTML = '';\n",
              "          dataTable['output_type'] = 'display_data';\n",
              "          await google.colab.output.renderOutput(dataTable, element);\n",
              "          const docLink = document.createElement('div');\n",
              "          docLink.innerHTML = docLinkHtml;\n",
              "          element.appendChild(docLink);\n",
              "        }\n",
              "      </script>\n",
              "    </div>\n",
              "  </div>\n",
              "  "
            ]
          },
          "metadata": {},
          "execution_count": 101
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "L72uqj6wRw44"
      },
      "execution_count": null,
      "outputs": []
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "collapsed_sections": [],
      "provenance": [],
      "mount_file_id": "1d5VDVNQZqiF2mYAzIfzL_4g8IdVnRb1M",
      "authorship_tag": "ABX9TyMOoO54DUdf281sZF6bB3Ce",
      "include_colab_link": true
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "1efaab196cdf413290a431658a7c37e8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_e950ba6862394e4483a706a568dcf3cb",
              "IPY_MODEL_d8e5f48f3f7840e0b838df80f9d07527",
              "IPY_MODEL_5449b664cffc4fbb8418fddcd42259b5"
            ],
            "layout": "IPY_MODEL_2a11a94624d34901806ceafd5108ca41"
          }
        },
        "e950ba6862394e4483a706a568dcf3cb": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_9209dbaeba4941a5841cc1ca3a4ae845",
            "placeholder": "​",
            "style": "IPY_MODEL_4b58dbaea1e64cc0887d32810f0b2994",
            "value": "100%"
          }
        },
        "d8e5f48f3f7840e0b838df80f9d07527": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_111db982b6c34747bd360624ea4cbe5e",
            "max": 5,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_295b69341c314474acc9de4eaab35361",
            "value": 5
          }
        },
        "5449b664cffc4fbb8418fddcd42259b5": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_18aa73713f2d4662b644a5da65ed0abc",
            "placeholder": "​",
            "style": "IPY_MODEL_709a75a2ea9544f3af191e5da3f455b1",
            "value": " 5/5 [00:02&lt;00:00,  2.49it/s]"
          }
        },
        "2a11a94624d34901806ceafd5108ca41": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "9209dbaeba4941a5841cc1ca3a4ae845": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "4b58dbaea1e64cc0887d32810f0b2994": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "111db982b6c34747bd360624ea4cbe5e": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "295b69341c314474acc9de4eaab35361": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "18aa73713f2d4662b644a5da65ed0abc": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "709a75a2ea9544f3af191e5da3f455b1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "41b1ff7ceb27460f8d728e6adbaabb73": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_77abcf0972874873bcd42396f9df50e8",
              "IPY_MODEL_c804100a751046b880c6f3d351fa8bc7",
              "IPY_MODEL_c2241e09ad504051a7eb87496c53f1a5"
            ],
            "layout": "IPY_MODEL_17e96e75dd304daf900d88d4f7048c6a"
          }
        },
        "77abcf0972874873bcd42396f9df50e8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_309e78727d274c75bdfbe6f3e0bc382c",
            "placeholder": "​",
            "style": "IPY_MODEL_b5ff4bccd4624e84bb0fd0a5f9039564",
            "value": "100%"
          }
        },
        "c804100a751046b880c6f3d351fa8bc7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_fee7a9b53c43490ea51965ec41493e32",
            "max": 5,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_2b0d37003ffd4f548bb493ff2f96fd40",
            "value": 5
          }
        },
        "c2241e09ad504051a7eb87496c53f1a5": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_efe083fa06ba4ef985fb8994f1b06c14",
            "placeholder": "​",
            "style": "IPY_MODEL_560a2a34c5d84469b61da36f5884a102",
            "value": " 5/5 [00:02&lt;00:00,  2.70it/s]"
          }
        },
        "17e96e75dd304daf900d88d4f7048c6a": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "309e78727d274c75bdfbe6f3e0bc382c": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "b5ff4bccd4624e84bb0fd0a5f9039564": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "fee7a9b53c43490ea51965ec41493e32": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "2b0d37003ffd4f548bb493ff2f96fd40": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "efe083fa06ba4ef985fb8994f1b06c14": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "560a2a34c5d84469b61da36f5884a102": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "1b31f8ee960a4559b7e928d98acd088b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_daeabfc06460439ebde9fb9436ff244a",
              "IPY_MODEL_90385338c5694374b42d47c84a76fcd9",
              "IPY_MODEL_fd2e438e8b4a47928e8d42476dca5c6a"
            ],
            "layout": "IPY_MODEL_99d03b6b90ae412891ed40a7f7a8fc17"
          }
        },
        "daeabfc06460439ebde9fb9436ff244a": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_d78d5b3f146f4604a78c08caae41b4d3",
            "placeholder": "​",
            "style": "IPY_MODEL_fa4d09ebbd604480bb7cfeaf6bcb4a2b",
            "value": "100%"
          }
        },
        "90385338c5694374b42d47c84a76fcd9": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_2884c008a0064b488b0e5e8882ab4db8",
            "max": 5,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_ff10c7e80e604bf9934af3d6c87b3d69",
            "value": 5
          }
        },
        "fd2e438e8b4a47928e8d42476dca5c6a": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_b5c7931dc5fb471f99612f60c6b1b6e6",
            "placeholder": "​",
            "style": "IPY_MODEL_75aa20be4912412b9326ad4fd175e94c",
            "value": " 5/5 [00:02&lt;00:00,  2.70it/s]"
          }
        },
        "99d03b6b90ae412891ed40a7f7a8fc17": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "d78d5b3f146f4604a78c08caae41b4d3": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "fa4d09ebbd604480bb7cfeaf6bcb4a2b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "2884c008a0064b488b0e5e8882ab4db8": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "ff10c7e80e604bf9934af3d6c87b3d69": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "b5c7931dc5fb471f99612f60c6b1b6e6": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "75aa20be4912412b9326ad4fd175e94c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "fb87df90c6754443b848d2906b70c20c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_897d441504394c13be74d6527d43e2ad",
              "IPY_MODEL_c5cf507b895043df88478cb0b36c88c8",
              "IPY_MODEL_34cf46270d844b4e9d9de27d9437a0bf"
            ],
            "layout": "IPY_MODEL_95fc5b04e9174cda9e6ba8859355eac2"
          }
        },
        "897d441504394c13be74d6527d43e2ad": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_0c145c54461e4f748e630608e572d656",
            "placeholder": "​",
            "style": "IPY_MODEL_a3d2d3776c50425e82e880aaf53266c5",
            "value": "100%"
          }
        },
        "c5cf507b895043df88478cb0b36c88c8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_810c4546e9a54279a0169a8f219921d1",
            "max": 5,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_4a5f6116b4504b79845fe0f024f76045",
            "value": 5
          }
        },
        "34cf46270d844b4e9d9de27d9437a0bf": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_a7e6451644684b0ba08b1fef97d8bffe",
            "placeholder": "​",
            "style": "IPY_MODEL_0bd6f854922b42209c34644d064fc784",
            "value": " 5/5 [00:02&lt;00:00,  2.69it/s]"
          }
        },
        "95fc5b04e9174cda9e6ba8859355eac2": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "0c145c54461e4f748e630608e572d656": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "a3d2d3776c50425e82e880aaf53266c5": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "810c4546e9a54279a0169a8f219921d1": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "4a5f6116b4504b79845fe0f024f76045": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "a7e6451644684b0ba08b1fef97d8bffe": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "0bd6f854922b42209c34644d064fc784": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "9a960e309c4547739b85684fd22a7434": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_1b04d7d7c64e46c7a65fec70a8aa6d47",
              "IPY_MODEL_62ca6a355eba4d8b9246196543651611",
              "IPY_MODEL_1dfb949779dd4c63a6008aa28c7ce877"
            ],
            "layout": "IPY_MODEL_a3d7e773a941411d843e1d97501bbbc1"
          }
        },
        "1b04d7d7c64e46c7a65fec70a8aa6d47": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_4161733518e9413dbfd46df36b44cdfc",
            "placeholder": "​",
            "style": "IPY_MODEL_fd55d9ea99994dbe9fcbde47912f6d3c",
            "value": "100%"
          }
        },
        "62ca6a355eba4d8b9246196543651611": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_c2bd8b713ab34602882409fce6ea137c",
            "max": 5,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_bad50a6972ba4cc89ace07948e418348",
            "value": 5
          }
        },
        "1dfb949779dd4c63a6008aa28c7ce877": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_2403434c28334c5b9fdc25e39177673d",
            "placeholder": "​",
            "style": "IPY_MODEL_a7268c5d50a8461eb505c826d7e7fa8f",
            "value": " 5/5 [00:02&lt;00:00,  2.68it/s]"
          }
        },
        "a3d7e773a941411d843e1d97501bbbc1": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "4161733518e9413dbfd46df36b44cdfc": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "fd55d9ea99994dbe9fcbde47912f6d3c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "c2bd8b713ab34602882409fce6ea137c": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "bad50a6972ba4cc89ace07948e418348": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "2403434c28334c5b9fdc25e39177673d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "a7268c5d50a8461eb505c826d7e7fa8f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "96f3fd4d5d8c41b0b1e90de870504274": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_65ab01632bcf4b7a8fc1c8226284ca35",
              "IPY_MODEL_5070cf89966f4169847c5f9fbc3bc607",
              "IPY_MODEL_13540c3628654bed8a11669c7070f499"
            ],
            "layout": "IPY_MODEL_8ad2aabc468c4ac28ca7ec74f5d5c609"
          }
        },
        "65ab01632bcf4b7a8fc1c8226284ca35": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_9fc13da36c3e4a0eb56ac32cfaa40f88",
            "placeholder": "​",
            "style": "IPY_MODEL_5ba1470b67624caf890815a747351c6b",
            "value": ""
          }
        },
        "5070cf89966f4169847c5f9fbc3bc607": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_4b54ca9031904579a18f8b08bdfc2b27",
            "max": 1,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_ce145570f63f4e63b9e36c2dd5e50392",
            "value": 0
          }
        },
        "13540c3628654bed8a11669c7070f499": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_50b92ebd8a87409bbca2981181978509",
            "placeholder": "​",
            "style": "IPY_MODEL_7b94dad419b641fca3c7eac0d1c5ffc2",
            "value": " 0/0 [00:00&lt;?, ?it/s]"
          }
        },
        "8ad2aabc468c4ac28ca7ec74f5d5c609": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "9fc13da36c3e4a0eb56ac32cfaa40f88": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "5ba1470b67624caf890815a747351c6b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "4b54ca9031904579a18f8b08bdfc2b27": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": "20px"
          }
        },
        "ce145570f63f4e63b9e36c2dd5e50392": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "50b92ebd8a87409bbca2981181978509": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "7b94dad419b641fca3c7eac0d1c5ffc2": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        }
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}